package com.mutouren.modules.datapush.base;

public enum ContentType {
	FORM((byte)0, "application/x-www-form-urlencoded"),
	PLAIN((byte)1, "text/plain"),
	XML((byte)2, "application/xml"),
	JSON((byte)3, "application/json");
	
	public final byte value;
	public final String name;

	private ContentType(byte value, String name) {
		this.value = value;		
		this.name = name;
	}
	
	public static ContentType valueOf(byte value) {
		ContentType result = null;
		
		switch(value) {
		case 0: result = FORM; break;
		case 1: result = PLAIN; break;
		case 2: result = XML; break;
		case 3: result = JSON; break;		
		}
		
		return result;
	}
	
	public static void main(String[] args) {	
		System.out.println(ContentType.FORM.toString());
	}	
}
// 内容类型: 0 form 1 plain 2 xml 3 json 
